home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 002. TESample.cpt / TESample.h < prev    next >
Text File  |  1988-08-02  |  6KB  |  143 lines

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.h    -    Rez Include Source
  10. #
  11. #    Copyright © 1988 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    1.0                    8/88
  15. #
  16. #    Components:    TESample.p            August 1, 1988
  17. #                TESample.c            August 1, 1988
  18. #                TESample.a            August 1, 1988
  19. #                TESample.r            August 1, 1988
  20. #                TESample.h            August 1, 1988
  21. #                PTESample.make        August 1, 1988
  22. #                CTESample.make        August 1, 1988
  23. #
  24. #    TESample is an example application that demonstrates how 
  25. #    to initialize the commonly used toolbox managers, operate 
  26. #    successfully under MultiFinder, handle desk accessories and 
  27. #    create, grow, and zoom windows. The fundamental TextEdit 
  28. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  29. #    also shows how to create and maintain scrollbar controls.
  30. #
  31. #    It does not by any means demonstrate all the techniques you 
  32. #    need for a large application. In particular, Sample does not 
  33. #    cover exception handling, multiple windows/documents, 
  34. #    sophisticated memory management, printing, or undo. All of 
  35. #    these are vital parts of a normal full-sized application.
  36. #
  37. #    This application is an example of the form of a Macintosh 
  38. #    application; it is NOT a template. It is NOT intended to be 
  39. #    used as a foundation for the next world-class, best-selling, 
  40. #    600K application. A stick figure drawing of the human body may 
  41. #    be a good example of the form for a painting, but that does not 
  42. #    mean it should be used as the basis for the next Mona Lisa.
  43. #
  44. #    We recommend that you review this program or Sample before 
  45. #    beginning a new application. Sample is a simple app. which doesn’t 
  46. #    use TextEdit or the Control Manager.
  47. #
  48. ------------------------------------------------------------------------------*/
  49.  
  50. /*    these #defines correspond to values in the Pascal source code.
  51.     Sample.c includes this file. */
  52.  
  53. #define kMinSize    40                /* application's minimum size (in K) */
  54. /* we looked at a heap dump while the program was running */
  55. /* it was using about 27K; we added 13K for stack, text & scraps */
  56. #define kPrefSize    60                /* application's preferred size (in K) */
  57. /* we made this (preferred) size bigger than the other (minimum) size */
  58. /* so you can have more text & scraps */
  59.  
  60. #define    rMenuBar    128                /* application's menu bar */
  61. #define    rAboutAlert    128                /* about alert */
  62. #define    rEditAlert    129                /* edit error alert */
  63. #define    rDocWindow    128                /* application's window */
  64. #define    rVScroll    128                /* vertical scrollbar control */
  65. #define    rHScroll    129                /* horizontal scrollbar control */
  66.  
  67. /* SysEnvironsVersion is passed to SysEnvirons to tell it which version of the
  68.    SysEnvRec we understand. */
  69. #define    sysEnvironsVersion        1
  70.  
  71. /* OSEvent is the event number of the suspend/resume and mouse-moved events sent
  72.    by MultiFinder. Once we determine that an event is an osEvent, we look at the
  73.    high byte of the message sent to determine which kind it is. To differentiate
  74.    suspend and resume events we check the resumeMask bit. */
  75. #define    osEvent                    app4Evt    /* event used by MultiFinder */
  76. #define    suspendResumeMessage    1        /* high byte of suspend/resume event message */
  77. #define    resumeMask                1        /* bit of message field for resume vs. suspend */
  78. #define    mouseMovedMessage        0xFA    /* high byte of mouse-moved event message */
  79.  
  80. /* The following constants are used to identify menus and their items. The menu IDs
  81.    have an "m" prefix and the item numbers within each menu have an "i" prefix. */
  82. #define    mApple                    128        /* Apple menu */
  83. #define    iAbout                    1
  84.  
  85. #define    mFile                    129        /* File menu */
  86. #define    iNew                    1
  87. #define    iClose                    4
  88. #define    iQuit                    12
  89.  
  90. #define    mEdit                    130        /* Edit menu */
  91. #define    iUndo                    1
  92. #define    iCut                    3
  93. #define    iCopy                    4
  94. #define    iPaste                    5
  95. #define    iClear                    6
  96.  
  97. /*    ExtremeNeg and ExtremePos are used to set up wide open rectangles and regions. */
  98. #define extremeNeg                -32768
  99. #define extremePos                32767 - 1 /* required to address an old region bug */
  100.  
  101. /*    TextMargin is the number of pixels we leave blank at the edge of the window. */
  102. #define textMargin                2
  103.  
  104. /* MaxOpenDocuments is used to determine whether a new document can be opened
  105.    or created. We keep track of the number of open documents, and disable the
  106.    menu items that create a new document when the maximum is reached. If the
  107.    number of documents falls below the maximum, the items are enabled again. */
  108. #define    maxOpenDocuments        1
  109.     
  110. /*    MaxDocWidth is an arbitrary number used to specify the width of the TERec's
  111.     destination rectangle so that word wrap and horizontal scrolling can be
  112.     demonstrated. */
  113. #define    maxDocWidth                576
  114.     
  115. /* MinDocWidth is used to limit the minimum dimension of a window when GrowWindow
  116.     is called. */
  117. #define    minDocDim                64
  118.     
  119. /*    MaxTELength is an arbitrary number used to limit the length of text in the TERec
  120.     so that various errors won't occur from too many characters being in the text. */
  121. #define    maxTELength                32000
  122.  
  123. /*    ControlInvisible is used to 'turn off' controls (i.e., cause the control not
  124.     to be redrawn as a result of some Control Manager call such as SetCtlValue)
  125.     by being put into the contrlVis field of the record. ControlVisible is used
  126.     the same way to 'turn on' the control. */
  127. #define controlInvisible        0
  128. #define controlVisible            0xFF
  129.  
  130. /*    ScrollBarAdjust, GrowBoxAdjust, and ScrollBar width are used in calculating
  131.     values for control positioning and sizing. */
  132. #define scrollbarAdjust            15
  133. #define growboxAdjust            13
  134. #define scrollbarWidth            16
  135.     
  136. /*    CrCharacter is used to compare for a carriage return when calculating the
  137.     number of lines in the TextEdit record. */
  138. #define crCharacter                13
  139.     
  140. /*    ButtonScroll is how many pixels to scroll horizontally when the button part
  141.     of the horizontal scrollbar is pressed. */
  142. #define buttonScroll            4
  143.